
def factory():
  pos = 2
  def go(step):
    nonlocal pos
    new_pos = pos + step
    pos = new_pos
    return new_pos
  return go

tourist = factory()
print(tourist(3))
print(tourist(5))con
print(tourist(7))

# 函数式编程是一种思维，闭包是一种体现

# 匿名函数 lambda表达式

f = lambda x,y: x if x > y else y
print(f(2,3))





